package com.gym.core.common;

/**
 * 可逆的加密工具
 * @author xinchun.wang 
   @email: 532002108@qq.com
 * @createTime 2015-1-6 下午3:41:35
 */
public class EncryptUtils {

	public static String encrypt(String str){
				  
		char[] data=new char[str.length()];
		str.getChars(0, str.length(), data, 0);
		  
		for(int i=0;i<str.length();i++){
		   
			if(data[i]=='Z') data[i]='A';
		    else data[i]+=1;		  
		}
		  
		String str2=new String(data);
		
		return str2;
	}
	
	public static String decrypt(String str){
		  
		char[] data=new char[str.length()];
		str.getChars(0, str.length(), data, 0);
		  
		for(int i=0;i<str.length();i++){
		   
			if(data[i]=='A') data[i]='Z';
		    else data[i]-=1;		  
		}
		  
		String str2=new String(data);
		
		return str2;
	}

}
